package com.river.springbootdemo.thinkingjava.objectrefer;

import lombok.Data;

import java.util.Random;

@Data
public class Pet {
    private int id;
    private String name;
    private static final String[] NAME_ARRAY = {"Rat", "Manx", "Cymric", "Mutt", "Pug"};
    private static final Random random = new Random(47);
    private static int tag = 0;

    Pet() {
        id = tag++;
        name = NAME_ARRAY[random.nextInt(5)];
    }

    public Pet(String s) {
        name = s;
    }

    @Override
    public String toString() {
        return name;
    }

}
